<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>角色用户配置</title>
<script type="text/javascript">
	var $userGrid;
	var $dataRoleDataGrid;
	var $roleDataGrid;
	var selectDataRolesTableRow;//选中的行数据
	var selectRoleTableRow;//选中的行数据
	var roleId="";//角色 id
	$(function() {
		$userGrid = $("#userGrid").datagrid($.extend(datagridOption, {
			url : "${ctx}/basic/user/dataGrids?roleId="+roleId,
			pageSize : 1000,
			pageList : [1000, 2000 ],
			columns : [ [ {
				field : 'ck',
				checkbox : true
			}, {
				field : 'loginNo',
				title : '登录账号',
				width : 100,
				sortable : true
			}, {
				field : 'trueName',
				title : '姓名',
				width : 160,
				sortable : true
			} ] ]
		 
		}));

		 
		$roleDataGrid = $("#roleDataGrid").datagrid($.extend(datagridOption, {
			title : "角色",
			url : "${ctx}/basic/roleUsers/rolesDataGrid",
			toolbar : '#rolett',
			columns : [ [ {
				field : 'ck',
				checkbox : true
			}, {
				field : 'roleName',
				title : '角色名称',
				width : 120,
				sortable : true
			}, {
				field : 'roleNo',
				title : '角色编号',
				width : 180,
				sortable : true
			} ] ],
			onClickRow : function(rowIndex, rowData) {
				 
				$userGrid.datagrid("reload","${ctx}/basic/user/dataGrids?roleId="+rowData.id);
			}
		}));
	 
		//角色查询
		$("#rolesearch").click(function() {
			var condition = "{search_LIKE_roleName:'" + $("#search_LIKE_roleName").val() + "'}";
			condition = eval('(' + condition + ')');
			$roleDataGrid.datagrid("load", condition || {});
		});

		//数据角色查询
		$("#datarolesearch").click(function() {
			var condition = "{search_LIKE_dataRoleName:'" + $("#search_LIKE_dataRoleName").val() + "'}";
			condition = eval('(' + condition + ')');
			$dataRoleDataGrid.datagrid("load", condition || {});
		});
	});
 
</script>
</head>

<body class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center'" data-options="fit:true" style="padding: 1px;">
		<div id="cc" class="easyui-layout" data-options="fit:true" style="width: 400px; height: 480px;">
			<div data-options="region:'west', split: true, collapsible:true" style="padding: 1px; witdh: 300px">
				<table id="roleDataGrid">
				</table>
			</div>
			< 
			<div id="userLayout" data-options="region:'center',  split: true,title:'用户信息', collapsible:true" style="padding: 1px; witdh: 300px">
				<table id="userGrid">
				</table>
				<div id="datarolett" class="easyui-toolbar">
					<span>数据角色名称：</span>
					<input type="text" id="search_LIKE_dataRoleName" style="margin-left: 2px; margin-right: 2px; padding-left: 2px; padding-right: 3px;" />
					<a id="datarolesearch" class="easyui-linkbutton" data-options="plain: true, iconCls: 'icon-hamburg-zoom'">查询</a>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
